home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qfiledialog.h.z / qfiledialog.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  4.0 KB  |  162 lines

  1. /****************************************************************************
  2. ** $Id: qfiledialog.h,v 2.20 1998/07/08 11:26:02 aavit Exp $
  3. **
  4. ** Definition of QFileDialog class
  5. **
  6. ** Created : 950428
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QFILEDIALOG_H
  25. #define QFILEDIALOG_H
  26.  
  27. struct QFileDialogPrivate;
  28. class QLineEdit;
  29. class QPushButton;
  30. class QListView;
  31. class QListViewItem;
  32. class QLabel;
  33. class QWidget;
  34.  
  35. #ifndef QT_H
  36. #include "qdir.h"
  37. #include "qdialog.h"
  38. #endif // QT_H
  39.  
  40.  
  41. class QFileIconProvider: public QObject
  42. {
  43.     Q_OBJECT
  44. public:
  45.     QFileIconProvider( QObject * parent = 0, const char * name = 0 );
  46.  
  47.     virtual const QPixmap * pixmap( const QFileInfo & );
  48. };
  49.  
  50.  
  51. class QFileDialog : public QDialog
  52. {
  53.     Q_OBJECT
  54. public:
  55.     QFileDialog( const char *dirName, const char *filter = 0,
  56.          QWidget *parent=0, const char *name=0, bool modal=FALSE );
  57.     QFileDialog( QWidget *parent=0, const char *name=0, bool modal=FALSE );
  58.    ~QFileDialog();
  59.  
  60.     // recommended static functions
  61.  
  62.     static QString getOpenFileName( const char *initially = 0,
  63.                     const char *filter= 0,
  64.                     QWidget *parent = 0, const char *name = 0);
  65.     static QString getSaveFileName( const char *initially = 0,
  66.                     const char *filter= 0,
  67.                     QWidget *parent = 0, const char *name = 0);
  68.     static QString getExistingDirectory( const char *dir = 0,
  69.                      QWidget *parent = 0,
  70.                      const char *name = 0 );
  71.  
  72.     // other static functions
  73.  
  74.     static void setIconProvider( QFileIconProvider * );
  75.     static QFileIconProvider * iconProvider();
  76.  
  77.     // non-static function for special needs
  78.  
  79.     QString selectedFile() const;
  80.     void setSelection( const char* );
  81.  
  82.     const char *dirPath() const;
  83.  
  84.     void setDir( const QDir & );
  85.     const QDir *dir() const;
  86.  
  87.     void rereadDir();
  88.  
  89.     enum Mode { AnyFile, ExistingFile, Directory };
  90.     void setMode( Mode );
  91.     Mode mode() const;
  92.  
  93.     bool eventFilter( QObject *, QEvent * );
  94.  
  95. public slots:
  96.     void setDir( const char * );
  97.     void setFilter( const char * );
  98.     void setFilters( const char ** );
  99.     void setFilters( const QStrList & );
  100.  
  101. signals:
  102.     void fileHighlighted( const char * );
  103.     void fileSelected( const char * );
  104.     void dirEntered( const char * );
  105.  
  106. private slots:
  107.     void fileSelected( int );
  108.     void fileHighlighted( int );
  109.     void dirSelected( int );
  110.     void pathSelected( int );
  111.  
  112.     void updateFileNameEdit( QListViewItem *);
  113.     void selectDirectoryOrFile( QListViewItem * );
  114.     void popupContextMenu( QListViewItem *, const QPoint &, int );
  115.     void fileNameEditDone();
  116.  
  117.     void okClicked();
  118.     void filterClicked(); // not used
  119.     void cancelClicked();
  120.  
  121.     void cdUpClicked();
  122.  
  123. protected:
  124.     void resizeEvent( QResizeEvent * );
  125.     void keyPressEvent( QKeyEvent * );
  126.  
  127.     void addWidgets( QLabel *, QWidget *, QPushButton * );
  128.  
  129. private slots:
  130.     void updateGeometry();
  131.     void modeButtonsDestroyed();
  132.  
  133. private:
  134.     void init();
  135.     void updatePathBox( const char * );
  136.     bool trySetSelection( const QFileInfo&, bool );
  137.  
  138.     QDir cwd;
  139.     QString fileName;
  140.  
  141.     QFileDialogPrivate *d;
  142.     QListView  *files;
  143.  
  144.     QLineEdit  *nameEdit; // also filter
  145.     void *unused1;
  146.     void *unused2;
  147.     void *unused3;
  148.     void *unused4;
  149.     void *unused5;
  150.     void *unused6;
  151.     void *unused7;
  152.     QPushButton *okB;
  153.     QPushButton *cancelB;
  154.  
  155. private:    // Disabled copy constructor and operator=
  156.     QFileDialog( const QFileDialog & );
  157.     QFileDialog &operator=( const QFileDialog & );
  158. };
  159.  
  160.  
  161. #endif // QFILEDIALOG_H
  162.